#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 5000
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Ant.Service.csproj", "./"]
COPY ["../Ant.Infrastructure/Ant.Dto/Ant.Dto.csproj", "../Ant.Infrastructure/Ant.Dto/"]
COPY ["../Ant.Infrastructure/Ant.EntityFrameworkCore/Ant.EntityFrameworkCore.csproj", "../Ant.Infrastructure/Ant.EntityFrameworkCore/"]
COPY ["../Ant.Infrastructure/Ant.DbServiceInterface/Ant.DbServiceInterface.csproj", "../Ant.Infrastructure/Ant.DbServiceInterface/"]
COPY ["../Ant.Infrastructure/Ant.DbService/Ant.DbService.csproj", "../Ant.Infrastructure/Ant.DbService/"]
RUN dotnet restore "./Ant.Service.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Ant.Service.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Ant.Service.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Ant.Service.dll"]